package com.ocr;

import java.util.ArrayList;
import java.util.List;

import com.ocr.*;
import com.adapter.LanguageAdapter;
import com.entity.Language;
import com.entity.LanguageContext;
import com.util.OCRCostant;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.AdapterView.OnItemClickListener;

public class SelectLanguageActivity extends Activity {
	private ListView listViewLanguage;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.popup_activity_choose_language);
		LanguageAdapter languageAdapter=new LanguageAdapter(getApplicationContext(),R.layout.item_language,LanguageContext.getListLanguages());
		listViewLanguage=(ListView) findViewById(R.id.list_languge);
		listViewLanguage.setAdapter(languageAdapter);
		
		listViewLanguage.setOnItemClickListener(new OnItemClickListener() {

			@Override
			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				// TODO Auto-generated method stub
				LanguageContext.setSelectedLanguagePosition(arg2);
				ImageActivity.SELECTED_LANG=LanguageContext.getSelectedLanguage();
				ImageActivity.BTN_SELECTE_LANG.setText(ImageActivity.SELECTED_LANG.getName());
				SelectLanguageActivity.this.finish();
			}
			
		});
	}

}
